Skip to content

fix(agent-isolation): zsh portability + opt-in default-claude alias - #15

Merged
potiuk merged 2 commits into
mainfrom
claude-iso-zsh-default
Apr 29, 2026
Merged

fix(agent-isolation): zsh portability + opt-in default-claude alias#15
potiuk merged 2 commits into
mainfrom
claude-iso-zsh-default

Conversation

@potiuk

@potiuk potiuk commented Apr 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Make tools/agent-isolation/claude-iso.sh portable to zsh: replace ${!var} indirect expansion, unquoted-scalar word-split of $CLAUDE_ISO_ALLOW, and command -v claude with shell-aware forms. Print a TTY-aware one-line stderr banner on launch.
  • Document the optional alias claude='claude-iso' pattern in secure-agent-setup.md so users who want the isolated wrapper as their default claude can opt in. The script's path-only lookup (now type -P / whence -p instead of command -v) is what makes the alias safe — without it, the alias would recurse.

Test plan

  • bash -n and zsh -n both parse the script cleanly.
  • source claude-iso.sh defines the claude-iso function in both bash and zsh.
  • prek run --files tools/agent-isolation/claude-iso.sh secure-agent-setup.md passes (doctoc, EOF, trailing-whitespace, mixed-line-ending, private-key check).
  • Reviewer to spot-check on a zsh host that an actual launch (claude-iso --help) emits the banner and exec's claude.

🤖 Generated with Claude Code

potiuk and others added 2 commits April 29, 2026 21:56
The wrapper used three bashisms that broke under zsh: ${!var}
indirect expansion ("bad substitution" in zsh), unquoted parameter
expansion for word-splitting $CLAUDE_ISO_ALLOW (zsh needs ${=var}
or an array), and `command -v claude` for binary lookup (which would
recurse through an `alias claude=claude-iso` if the user adopts the
wrapper as their default). Replace each with a shell-aware form, and
print a one-line stderr banner on each launch so the isolated mode
is visually distinguishable from a plain `claude` session.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add a short "Optional — make the isolated wrapper your default
claude" subsection under "The clean-env wrapper", documenting the
`alias claude='claude-iso'` pattern, the bypass escape hatches
(`command claude`, `\claude`), and the trade-off (sessions outside
a tracker checkout also run with a stripped env). The script's
shell-aware path lookup landed in the previous commit so the alias
no longer recurses into itself.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@potiuk
potiuk merged commit 97dca75 into main Apr 29, 2026
5 checks passed
@potiuk
potiuk deleted the claude-iso-zsh-default branch April 29, 2026 19:57
@andreahlert andreahlert added the mode:platform Substrate / infra — not a mode (sandbox, CI, validators) label May 7, 2026
potiuk pushed a commit that referenced this pull request Jul 1, 2026
…overrides/ (#665)

* chore(spec-loop): consolidate implementation plan

Collapse "What's been built" to one line per item; all 22 planned work
items preserved verbatim; redundant shipped-state notes trimmed.

Generated-by: Claude (Opus 4.7)

* feat(validator): add override-file contract check for .apache-magpie-overrides/

Add a new SOFT advisory check (check #15) to the skill-and-tool-validator
that validates .apache-magpie-overrides/<skill>.md files in adopter repos.

Two advisory checks per file:
- Structure: the canonical 'apache-magpie agentic override' header comment
  must be present (confirms the file was created via /magpie-setup override).
- Baseline integrity: heuristic scan for patterns attempting to weaken the
  framework safety / confidentiality / privacy / data-not-instructions
  baseline (ignore safety, bypass confidentiality, skip privacy-llm-gate,
  treat external content as instructions, disclose confidential reports).

HTML comment lines are excluded from the weakening scan to avoid flagging
prose that explains what NOT to do. The directory scanner silently skips
repos without an override directory. All violations are SOFT advisory.

21 new tests cover: clean override passes, missing header, each weakening
pattern, HTML-comment exclusion, directory scanner, README.md skip,
multi-file coverage, and discoverable-without-editing-skill confirmation.

Also clears the override-file contract gap from specs/adoption-and-setup.md.

Generated-by: Claude (Opus 4.7)
potiuk pushed a commit to justinmclean/airflow-steward that referenced this pull request Jul 1, 2026
…visory)

Add validate_project_template_drift (check apache#15) to
tools/skill-and-tool-validator to mechanically compare
projects/_template/ with projects/non-asf-example/ for structural
drift, closing the Known gap in specs/project-agnosticism.md.

Three SOFT advisory checks under the new template-drift category:

1. README file-list coherence: every file linked in the ## Files
   section of non-asf-example/README.md must exist on disk.
2. Undocumented files: every .md file in non-asf-example/ (other
   than README.md) must be mentioned somewhere in its README.
3. Shared-file h2 alignment: for each .md file present in both
   profiles, h2 section headings are compared. project.md and
   README.md are excluded since they differ intentionally by
   organization profile (org-inherited blocks, narrative structure).

22 new tests in TestProjectTemplateDrift cover all checks, the
live-repo clean-state assertion, DocToc-stripping, exclusion of
parent-traversal and external URLs, and the project.md/README.md
exemptions. The live tree produces zero template-drift violations.

Updates specs/project-agnosticism.md Known gaps to document the
new check and its scope.

Generated-by: Claude (Opus 4.7)
potiuk pushed a commit that referenced this pull request Jul 1, 2026
#663)

Add validate_project_template_drift (check #15) to
tools/skill-and-tool-validator to mechanically compare
projects/_template/ with projects/non-asf-example/ for structural
drift, closing the Known gap in specs/project-agnosticism.md.

Three SOFT advisory checks under the new template-drift category:

1. README file-list coherence: every file linked in the ## Files
   section of non-asf-example/README.md must exist on disk.
2. Undocumented files: every .md file in non-asf-example/ (other
   than README.md) must be mentioned somewhere in its README.
3. Shared-file h2 alignment: for each .md file present in both
   profiles, h2 section headings are compared. project.md and
   README.md are excluded since they differ intentionally by
   organization profile (org-inherited blocks, narrative structure).

22 new tests in TestProjectTemplateDrift cover all checks, the
live-repo clean-state assertion, DocToc-stripping, exclusion of
parent-traversal and external URLs, and the project.md/README.md
exemptions. The live tree produces zero template-drift violations.

Updates specs/project-agnosticism.md Known gaps to document the
new check and its scope.

Generated-by: Claude (Opus 4.7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mode:platform Substrate / infra — not a mode (sandbox, CI, validators)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants